const data = {
    "": "",
    "Variant": {
        "V71_9DCT": false,
        "V71_GT_9DCT": false,
        "V71_PHEV_DHT": false,
        "V71_PHEVG_DHT": false,
        "V71_PHEV_9HDCT": false,
        "V71_PHEVG_9HDCT": false,
        "V71_PHEV_9HDCT_EU": false,
        "V71_PHEV_9HDCT_NA": false,
        "V71_Dasy_HWATGU": false,
        "V61_9DCT": false,
        "V61_PHEV_9HDCT": false,
        "V61_PHEV_DHT": false,
        "V61_PHEV_9HDCT_EU": false,
        "V61_PHEV_9HDCT_NA": false,
        "V61_Dasy_HWATGU": false,
        "V51_9DCT": false,
        "V51_DHT": false,
        "V51_EV_SingleGR": false,
        "V51_EV_IB_SingleGR": false,
        "P01_8AT": false,
        "A01G_THA_7DCT": false,
        "A01G_THA_DHT": false,
        "A01G_HEV": false,
        "B03G_ICE_7DCT": false,
        "B06G_7DCT_0": false,
        "B06R_7DCT_0": false,
        "B01_1_ICE_0": false,
        "B01_1_HEV_0": false,
        "B02_ICE_9DCT_0": false,
        "B02_HEV_DHT_0": false,
        "B03_ICE_7DCT_0": false,
        "B03_HEV_DHT_0": false,
        "B04_ICE_9DCT_0": false,
        "B04_HEV_DHT_0": false,
        "B03G_7DCT_0": false,
        "": ""
    },
    "Parameter": {
        "EE_Arch": 0,
        "CUDA_Template": "C1",
        "DLC": 8
    },
    "T01_FSI_Tx": {
        "T0106_TX_AliveCounter": false,
        "T0106_TX_Checksum": false,
        "T0106_TX_Cycletime_DLC": false
    },
    "T01_FSI_Diag_DID": {
        "T": false,
        "TestCases": {
            "T0102_Dia_DID_Nightly_Test": false,
            "": ""
        }
    },
    "T01_FSI_FM_Timeout": {
        "T": false,
        "TestCases": {
            "T0109_Timeout": false,
            "": ""
        }
    },
    "T01_FSI_FM_MsgDlc": {
        "T": false,
        "TestCases": {
            "T0112_MsgDLC": false,
            "": ""
        }
    },
    "T01_FSI_FM_AliveCounter": {
        "T": false,
        "TestCases": {
            "T0111_AliveCounter": false,
            "": ""
        }
    },
    "T01_FSI_FM_Checksum": {
        "T": false,
        "TestCases": {
            "T0110_Checksum": false,
            "": ""
        }
    },
    "T01_FSI_FM_SignalMonitoring": {
        "T": false,
        "TestCases": {
            "T0130_SignalMonitoring": false,
            "": ""
        }
    },
    "T01_FSI_FM_Other": {
        "T": false,
        "TestCases": {
            "T0113_OtherMonitoring": false,
            "": ""
        }
    },
    "T01_FSI_Diag_Service": {
        "T": false,
        "TestCases": {
            "Dia_Network_Layer_Parameter": false,
            "SID_0x10": false,
            "SID_0x11": false,
            "SID_0x27": false,
            "SID_0x22": false,
            "SID_0x2E": false,
            "SID_0x19": false,
            "SID_0x14": false,
            "SID_0x28": false,
            "SID_0x85": false,
            "SID_0x3E": false,
            "T0105_Dia_Service_Nightly_Test": false,
            "": ""
        }
    },
    "T01_FSI_CDM": {
        "T": false,
        "TestCases": {
            "T0107_Central_Degradation": false,
            "": ""
        }
    },
    "T01_FSI_DTC_EnableCondition": {
        "T": false,
        "TestCases": {
            "T0104_DTC_EnableCondition": false,
            "": ""
        }
    },
    "T01_FSI_DTC_Snapshot": {
        "T": false,
        "TestCases": {
            "T0104_DTC_Snapshot": false,
            "": ""
        }
    },
    "T01_FSI_Diag_ExtendedData": {
        "T": false,
        "TestCases": {
            "T0104_DTC_ExtendedData": false,
            "": ""
        }
    },
    "T01_FSI_TimeSync": {
        "T": false,
        "TestCases": {
            "T0106_TX_TimeSync": false,
            "": ""
        }
    },
    "T01_FSI_COM_Mapping": {
        "T": false,
        "TestCases": {
            "T0101_SignalMapping": false,
            "T0113_SignalMappingPri": false,
            "T0113_SignalboundaryProtectionPri": false,
            "": ""
        }
    },
    "T01_FSI_Diag_DID_Others": {
        "T": false,
        "TestCases": {
            "T0102_INVALID_DID": false,
            "T0102_NVM_test_write_in_old_read_in_new": false,
            "T0102_NVM_test_write_read_in_new_version": false,
            "": ""
        }
    },
    "T01_FSI_Voltage_test": {
        "T": false,
        "TestCases": {
            "T0108_LowVoltage": false,
            "T0108_HighVoltage": false,
            "": ""
        }
    },
    "T01_FSI_COM_General": {
        "T": false,
        "TestCases": {
            "T0101_Message_enumeration": true,
            "": ""
        }
    }
}

var fs = require('fs')
var JSON_FILE_PATH = require('../config/config.js').JSON_FILE_PATH


export default {
  // 支持值为 Object 和 Array
  'GET /config': (req, res) =>{
      console.log('===', JSON_FILE_PATH)
      const confStr = fs.readFileSync(JSON_FILE_PATH).toString()
      res.send(confStr)
  }, 

  'POST /saveConfig': (req, res) =>{
      console.log('====res.json', req.body)
      fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(req.body))
      res.send('ok')
  }


}


